var t = getApp();

Page({
    data: {
        detail: [ {
            id: 0,
            tit: "活动项目"
        }, {
            id: 1,
            tit: "课程商品"
        } ],
        pageTwo: 1,
        page: 1,
        curr: "1",
        member_id: "",
        tapShow: !1
    },
    onLoad: function(t) {
        console.log(t.id), this.setData({
            member_id: t.id,
            kid: t.eid
        }), this.getList(), this.getShop();
    },
    tapStatus: function(t) {
        console.log(t.target.id), this.setData({
            curr: t.target.id
        });
    },
    goDingdan: function(t) {
        console.log(t.currentTarget.id), wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + t.currentTarget.id
        });
    },
    goxq: function(t) {
        console.log(t.currentTarget.id), wx.navigateTo({
            url: "/packageC/Myshaky/enrollEnter/enrollEnter?id=" + t.currentTarget.id
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        console.log(this.data.current_page, this.data.last_page), this.data.List_current_page >= this.data.List_last_page ? wx.showToast({
            title: "没有更多",
            icon: "none"
        }) : (this.setData({
            page: this.data.pageTwo + 1
        }), this.nextgetShop());
    },
    onShareAppMessage: function() {},
    getList: function() {
        var a = t.getNetAddresss("plugin.activity-apply.api.lecturer.getRelevance"), e = this;
        t._getNetWork({
            url: a,
            data: {
                member_id: e.data.member_id,
                page: this.data.page
            },
            success: function(t) {
                var a = t.data;
                1 == a.result && (console.log(a.data.lecturer), console.log(!a.data.lecturer.introduce), 
                wx.setNavigationBarTitle({
                    title: "".concat(a.data.lecturer.lecturer_title || "讲师", "详情")
                }), e.setData({
                    total: a.data.list.total,
                    lecturer: a.data.lecturer,
                    list: a.data.list.data,
                    List_current_page: a.data.list.current_page,
                    List_last_page: a.data.list.last_page
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getShop: function() {
        var a = t.getNetAddresss("plugin.activity-apply.api.lecturer.getCourse"), e = this;
        t._getNetWork({
            url: a,
            data: {
                id: e.data.kid,
                page: this.data.pageTwo
            },
            success: function(t) {
                var a = t.data;
                1 == a.result && (console.log(a), e.setData({
                    shopTotal: a.data.couser.total,
                    shopList: a.data.couser.data,
                    current_page: a.data.couser.current_page,
                    last_page: a.data.couser.last_page
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    nextgetList: function() {
        var a = t.getNetAddresss("plugin.activity-apply.api.lecturer.getRelevance"), e = this;
        t._getNetWork({
            url: a,
            data: {
                member_id: e.data.member_id,
                page: this.data.page
            },
            success: function(t) {
                var a = t.data;
                1 == a.result && e.setData({
                    total: a.data.list.total,
                    list: e.data.list.concat(a.data.list.data),
                    List_current_page: a.data.list.current_page,
                    List_last_page: a.data.list.last_page
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    nextgetShop: function() {
        var a = t.getNetAddresss("plugin.activity-apply.api.lecturer.getCourse"), e = this;
        t._getNetWork({
            url: a,
            data: {
                id: e.data.kid,
                page: e.data.pageTwo
            },
            success: function(t) {
                var a = t.data;
                if (1 == a.result) {
                    if (console.log(a), a.data.couser.current_page > a.data.couser.last_page) return wx.hideLoading(), 
                    wx.showToast({
                        title: "没有更多",
                        icon: "none"
                    }), void e.setData({
                        current_page: a.data.couser.current_page,
                        last_page: a.data.couser.last_page
                    });
                    wx.hideLoading(), e.setData({
                        current_page: a.data.couser.current_page,
                        last_page: a.data.couser.last_page,
                        shopList: e.data.shopList.concat(a.data.couser.data)
                    });
                }
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    setTapShow: function() {
        this.setData({
            tapShow: !this.data.tapShow
        });
    }
});